import { defineConfig } from "vite";
import uni from "@dcloudio/vite-plugin-uni";
import Config from "./src/config/index";

// https://vitejs.dev/config/
export default defineConfig({
  server: {
    proxy: {
      "/api": {
        target: Config.baseURL,
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
      "/ETL/websocket/": {
        target: `wss://isafe.hnredsolar.com/ETL/websocket/`,
        ws: true,
      },
    },
  },
  build: {
    assetsInlineLimit: 5000000,
    sourcemap: true,
  },
  plugins: [uni()],
});
